import { BasePromiseResultType } from "#/request";
import { getRequest } from "./request_create";

const uniRequest = {
  post: async <T>(url: string, data?: any, headers?: any, responesData?: any): Promise<BasePromiseResultType<T>> => {
    return getRequest('post', url, null, data, headers, responesData)
  },
  export: async (url: string, data?: any, headers?: any, responesData?: any): Promise<any> => {
    return getRequest('post', url, null, data, headers, responesData || { responseType: 'blob' })
  },
  get: async <T>(url: string, params?: any, headers?: any, responesData?: any): Promise<BasePromiseResultType<T>> => {
    return getRequest('get', url, params, null, headers, responesData)
  },
  // cancelRequest: () => {
  //   clearSource.cancel('Operation canceled by the user.')
  // },
};
export default uniRequest